/*
 * @Author: szx
 * @Date: 2022-01-15 12:27:28
 * @LastEditTime: 2022-01-15 12:37:10
 * @Description: 
 * @FilePath: \leetcode\1700-1799\1716\1716.js
 */
/**
 * @param {number} n
 * @return {number}
 */
var totalMoney = function (n) {
    const week = Math.floor(n / 7);
    const arr = [0, 1, 3, 6, 10, 15, 21, 28]
    const day = n % 7;
    return (21 + day) * week + Math.floor(week * (week + 1) / 2 * 7) + arr[day];
};
console.log(totalMoney(20))